import java.util.Scanner;

public class test {
    public static int sout(int a){
        if(a < 10){
            return a;
        }else {
            return a%10+sout(a/10);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sout(a);
        System.out.println(b);
    }


    public static void feibonaqie(int a){
        int b = 1;
        int c = 1;
        int sum = 0;
        if(a == 1 ||a == 2){
            sum = 1;
        }else{
            for(int i = 3; i <= a ; i++){
                sum = b + c;
                b = c;
                c = sum;
            }
            System.out.println(sum);
        }
    }
    public static void main6(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        feibonaqie(a);
    }


    public static void add2(int a){
        if(a > 9){
            add2(a/10);
        }
        System.out.println(a%10);
    }
    public static void main5(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        add2(a);
    }


    public static int sum1(int a){
        if(a == 1){
            return 1;
        }else {
            return a+sum1(a-1);
        }
    }
    public static void main4(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sum1(a);
        System.out.println(b);
    }




    public  static int sum(int a){
        if(a == 1){
            return 1;
        }else {
            return a*sum(a - 1);
        }
    }
    public static void main3(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sum(a);
        System.out.println(b);
    }




    public static int max(int a,int b){
        return a > b ? a :b;
    }

    public static double max(double a,double b,double c){
        if(a > b){
            return a > c ? a : c;
        }else{
            return b > c ? b : c;
        }
    }
    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        int intMax=max(2,3);
        Double doubleMax = max(1.1,2.2,3.3);
        System.out.println("两个整数最大的是"+intMax);
        System.out.println("三个小数里面最大的是"+doubleMax);
    }

    public static int add(int a){
        if(a == 1 || a == 2){
            return 1;
        }else{
            return add(a-1)+add(a-2);
        }
    }
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = add(a);
        System.out.println(b);
    }
}
